package com.lry.basic.algorithm.common;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;

/**
 * @author:刘仁有
 * @desc:
 * @email:953506233@qq.com
 * @data:2019/7/18
 */
public class Bit {

    public static void main(String[] args) {
        Bit bit = new Bit();
        System.out.println(bit.singleNumber(new int[]{1, 2, 2, 3, 3,4,4}));
    }
    //除了某个元素只出现一次以外，其余每个元素均出现两次
    public int singleNumber(int[] nums){
       for(int i=1;i<nums.length;i++){
           nums[0]^=nums[i];
       }
        return  nums[0] ;
    }
    public boolean isPowerOfTwo(int n) {
        return n>0&&(n&(n-1))==0;
    }
}
